package flst.ipiweb.proxy;

import java.util.List;

import flst.ipiweb.process.AdminProcess;
import flst.ipiweb.transverse.Admin;
import flst.ipiweb.transverse.IPIWebException;

public class AdminProxy {

	private AdminProcess padm;
	private boolean droits=false;
	
	public AdminProxy() {
		padm = new AdminProcess();
	}
	
	public boolean getDroits() {
		return droits;
	}

	public void setDroits(boolean droits) {
		this.droits = droits;
	}
	
	
	public List<Admin> GetAllAdmin() throws IPIWebException{
		if(droits==true){
			return padm.GetAllAdmin();
		}
		else{
			return null;
		}
	}

	public void CreateAdmin(Admin adm) throws IPIWebException{
		if(droits){
			padm.CreateAdmin(adm);
		}
	}
	
	public void UpdateAdmin(Admin adm) throws IPIWebException{
		if(droits){
			padm.UpdateAdmin(adm);
		}
	}
	
	public Admin GetAdminByLogin(String login) throws IPIWebException{
		if(droits){
			return padm.GetAdminByLogin(login);
		}
		else{
			return null;
		}
	}
	
	public Admin GetAdminById(int id) throws IPIWebException{
		if(droits){
			return padm.GetAdminById(id);
		}
		else{
			return null;
		}
	}
	
	public void deleteAdmin(int id) throws IPIWebException{
		if(droits){
			padm.deleteAdmin(id);
		}
	}

	public Boolean checkLogin(String login) throws IPIWebException{
		if(droits){
			return padm.CheckLogin(login);
		}
		else{
			return null;
		}
	}
	
	
}
